<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../resource/js/layuimini-v2/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../resource/js/layuimini-v2/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="../resource/js/layuimini-v2/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>新建表</legend>
        </fieldset>

        <div class="layui-input-block">
            <button type="button" class="layui-btn addFiledBtn" lay-submit lay-filter="demo1">添加</button>
        </div>
        <br/>
        <div class="layui-form-item">
            <label class="layui-form-label">表名</label>
            <div class="layui-input-block">
                <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入表名" class="layui-input name">
            </div>
        </div>


        <div class="layui-form filedContent" action="">

        </div>
    </div>
</div>

<script type="text/html" id="addFiled">
    <div class="layui-form-item">
        <label class="layui-form-label">列名</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autoComplete="off" placeholder="请输入表名"
                   class="layui-input name"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
            <select name="interest" lay-filter="aihao">
                <option value=""></option>
                {{range $key, $value := .FieldType}}
                    <option value="{{$key}}" len="{{$value}}">{{$key}}</option>
                {{end}}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">长度</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="title" autoComplete="off" placeholder="请输入表名"
                   class="layui-input name"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否主键</label>
        <div class="layui-input-block">
            <input type="checkbox" name="" lay-skin="tag" title="主键">
        </div>
    </div>
</script>
<script src="../resource/js/layuimini-v2/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="../resource/js/layuimini-v2/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    var linkId = '{{.LinkId}}';
    var dbName = '{{.DbName}}';

    $(".addFiledBtn").on("click",function (){
        var addFiled = $("#addFiled").html();
        $(".filedContent").append(addFiled);
        $(".filedContent").trigger("create");
    })

</script>

</body>
</html>